#pragma once
#include <stdint.h>
#include <string.h>

#define IMG_W 160
#define IMG_H 120
#define THRESHOLD 30

void compute_frame_diff(const uint8_t* curr, const uint8_t* prev, uint8_t* diff) {
    for (int i = 0; i < IMG_W * IMG_H; i++) {
        int delta = curr[i] - prev[i];
        diff[i] = (delta * delta > THRESHOLD * THRESHOLD) ? 255 : 0;
    }
}